package com.qk.management.mapper;

import com.qk.entity.Role;
import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface RoleMapper {
    List<Role> selectAllRoles(@Param("name") String name,@Param("label") String label);

    @Delete("delete from role where id=#{id}")
    void delete(Integer id);

    @Insert("insert into role(name,label,remark,create_time,update_time) values(#{name},#{label},#{remark},#{createTime},#{updateTime})")
    void insert(Role role);

    @Select("select * from role where id=#{id}")
    Role selectRoleById(Integer id);

    void update(
            @Param("id") Integer id,
            @Param("name") String name,
            @Param("label") String label,
            @Param("remark") String remark,
            @Param("updateTime") LocalDateTime updateTime
    );

    @Select("select * from role")
    List<Role> selectAll();
}
